package geektime.spring.springbucks.waiterservice;

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableCaching
public class WaiterServiceApplication {

  public static void main(String[] args) {
    SpringApplication.run(WaiterServiceApplication.class, args);
  }

  @Bean
  public Hibernate5Module hibernate5Module() {
    return new Hibernate5Module();
  }

  @Bean
  public Jackson2ObjectMapperBuilderCustomizer jacksonBuilderCustomizer(){
    return  builder->{
      builder.indentOutput(true);
      builder.timeZone(TimeZone.getTimeZone("Asia/Shanghai"));
    };
  }
}


